package flex.cc.order.manage.enums;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.List;
import java.util.Map;

/**
*
* @author WANGCONG
* 2021年9月18日下午12:18:17
* @desc 车服系统自己的服务单状态对应关系
*/

public enum OrderStatusEnum {
	
	INIT("00", "派发失败"),
    ONE("01", "待处理"),
    TWO("02", "已受理"),
    THREE("03", "已派单"),
	FOUR("04", "已接单"),
	FIVE("05", "开始出发"),
	SIX("06", "到达现场"),
	SEVEN("07", "开始作业"),
	EIGHT("08", "已完成"),
    NINE("09", "服务取消"),
    TEN("10", "取消有费用"),
    ELEVEN("11", "取消无费用");
	
    String type;
    String name;

    OrderStatusEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public static String getName(String type) {
        for (OrderStatusEnum ele : OrderStatusEnum.values()) {
            if (type.equals(ele.getType())) {
                return ele.getName();
            }
        }
        return "";
    }

    public static OrderStatusEnum getEnum(String type) {
        for (OrderStatusEnum ele : OrderStatusEnum.values()) {
            if (type.equals(ele.getType())) {
                return ele;
            }
        }
		return null;
    }

    public static List<Map<String, Object>> getList() {
        List<Map<String, Object>> list = Lists.newArrayList();
        for (OrderStatusEnum ele : OrderStatusEnum.values()) {
            Map<String, Object> map = Maps.newHashMap();
            map.put("key", ele.getType());
            map.put("value", ele.getName());
            list.add(map);
        }
        return list;
    }
}
